﻿using OneP.InfinityScrollView;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ClubListsItem : InfinityBaseItem
{
    public Text post, name, id, gold;
    public Button Des;
    public override void Reload(InfinityScrollView _infinity, int _index)
    {
        if (SaveDate.GetInstance().ClubInfoRet.OneList[_index].Online==1)//在线
        {
            post.color = new Color(200 / 255f, 183 / 255f, 234 / 255f);
            name.color = new Color(200 / 255f, 183 / 255f, 234 / 255f);
            id.color = new Color(200 / 255f, 183 / 255f, 234 / 255f);
            gold.color = new Color(200 / 255f, 183 / 255f, 234 / 255f);
        }
        else
        {
            post.color = new Color(116 / 255f, 112 / 255f, 124 / 255f);
            name.color = new Color(116 / 255f, 112 / 255f, 124 / 255f);
            id.color = new Color(116 / 255f, 112 / 255f, 124 / 255f);
            gold.color = new Color(116 / 255f, 112 / 255f, 124 / 255f);
        }
        if (SaveDate.GetInstance().ClubInfoRet.OneList[_index].Level==0)
        {
            post.text = "会员";
        }
        else if(SaveDate.GetInstance().ClubInfoRet.OneList[_index].Level == 1)
        {
            post.text = "管理";
        }
        else
        {
            post.text = "部长";
            if (SaveDate.GetInstance().ClubInfoRet.OneList[_index].Username==GameData.GetInstance().userName)
            {
                GameObject OtherClubList = GameObject.Find("OtherClubList(Clone)");
                if (OtherClubList)
                {
                    OtherClubList.transform.GetChild(0).GetChild(1).GetChild(2).gameObject.SetActive(false);
                }
            }
        }
        name.text = SaveDate.GetInstance().ClubInfoRet.OneList[_index].Username;
        id.text = SaveDate.GetInstance().ClubInfoRet.OneList[_index].Id.ToString();
        gold.text = SaveDate.GetInstance().ClubInfoRet.OneList[_index].Score.ToString();
        if (SaveDate.GetInstance().ClubInfoRet.OneList[_index].IsShow)
        {
            Des.gameObject.SetActive(true);
        }
    }

    public void Send167()
    {
        MessageManager.GetInstance().Send7167(id.text, SaveDate.GetInstance().ClubInfoRet.ClubID);
        Destroy(this.gameObject);
    }
}
